#include "test.h"
#include <signal.h>

static int count = 0;
void sig_handle(int num)
{
    printf("sig catched\n");
    count++;
    if (count > 5)
        signal(SIGINT, SIG_DFL);
}

int signal_test(int argc, char *argv[])
{
    signal(SIGINT, sig_handle);
    int i;
    for (i = 0; i < 10; i++)
    {
        printf("hello, world!\n");
        NX_ThreadSleep(1000);
        if (i == 5)
        {
            raise(SIGSEGV);
        }
    }
    return 0;
}


